home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
pdox693.zip
/
TI1108.ASC
< prev
next >
Wrap
Text File
|
1992-08-17
|
4KB
|
133 lines
PRODUCT : Paradox NUMBER : 1108
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 1/2
TITLE : Doing a Block Comment in the Text Editor
┌───────────────────────────────────────────────────────────────┐
│ │
│ This Technical Information Sheet is intended only for users │
│ who are familiar with PAL. It contains PAL code to demon- │
│ strate a model solution to a specific problem and is not │
│ intended to represent a complete programming solution. │
│ Programmers who use this code must take responsibility for │
│ debugging and developing their application. Assistance │
│ in debugging and developing applications is considered │
│ consulting and is beyond the scope of technical support. │
│ │
└───────────────────────────────────────────────────────────────┘
The following code allows a user to comment a section of text
that has been blocked. Blocking of text is accomplished by one
of two ways:
1. Holding down the mouse button and dragging the cursor over
the area to be blocked.
2. Holding down a shift key and using the cursor keys to move
over the area to be commented.
Play the following script by holding the Alt key, pressing <F10>
and selecting the Play menu option. You can also assign a hotkey
to play this script with the SETKEY command.
EDITOR INFO COMPLETE TO commentbag ;get current editor info
IF NOT Retval THEN ;must not be in an editor session
BEEP
QUIT "Block operations not valid in this context"
ENDIF
IF commentbag["OVERWRITE"] = TRUE THEN ;Insert or overwrite mode?
overwrite = True
INS
ELSE overwrite = False
ENDIF
IF commentbag["SELSTART"] = 0 THEN ;Is there a marked area?
QUIT "No marked area"
ENDIF
PRODUCT : Paradox NUMBER : 1108
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 2/2
TITLE : Doing a Block Comment in the Text Editor
charlen = commentbag["SELEND"] ;Get end of marked block
EDITOR GOTO POSITION commentbag["SELSTART"]
;Move to beginning of block
EDITOR INFO COMPLETE TO commentbag
WHILE commentbag["CHARPOS"] <= charlen
;While we are not at the end of the original marked block,
;mark the current line, extract to a variable, and determine
;if the first character is a semicolon. If it's not, then
;insert a semicolon at the beginning of the variable, delete
;the current line and replace it with the variable.
SHIFTPRESS "end" ;Mark a line
EDITOR INFO TO commentbag ;Get current locations
EDITOR EXTRACT TO x ;
IF SUBSTR(x,1,1) <> ";" AND x <> "" THEN
x = ";"+x
DEL
TYPEIN x
ENDIF
IF commentbag["SELEND"] = charlen THEN
QUITLOOP
ENDIF
HOME
DOWN
ENDWHILE
IF overwrite THEN
INS
ENDIF
DISCLAIMER: You have the right to use this technical information subject to
the terms of the No-Nonsense License Statement that you received with the
Borland product to which this information pertains.